Divides the plane into rectangles, counts the number of cases in each rectangle, and then (by default) maps the number of cases to the rectangle’s fill and convert it into ggplotly
d <- ggplot(diamonds, aes(x, y)) + xlim(4, 10) + ylim(4, 10)
p <- d + geom_bin_2d()
plotly::ggplotly(p)
## Warning: Removed 478 rows containing non-finite values (stat_bin2d).
d <- ggplot(diamonds, aes(x, y)) + xlim(4, 10) + ylim(4, 10)
p <- d + geom_bin_2d(bins = 10)
plotly::ggplotly(p)
## Warning: Removed 478 rows containing non-finite values (stat_bin2d).
d <- ggplot(diamonds, aes(x, y)) + xlim(4, 10) + ylim(4, 10)
p <- d + geom_bin_2d(bins = 30)
plotly::ggplotly(p)
## Warning: Removed 478 rows containing non-finite values (stat_bin2d).
d <- ggplot(diamonds, aes(x, y)) + xlim(4, 10) + ylim(4, 10)
p <- d + geom_bin_2d(binwidth = c(0.1, 0.1))
plotly::ggplotly(p)
## Warning: Removed 478 rows containing non-finite values (stat_bin2d).